<?php

namespace Vozminoski\StoreBundle\Controller\Admin;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * Catalog controller.
 *
 * @Route("/order")
 */
class OrderController extends Controller
{
    /**
     * Lists all Catalog entities.
     *
     * @Route("/", name="admin_order")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('VozminoskiStoreBundle:Orders')->findAll();

        return $this->render('VozminoskiStoreBundle:Admin/Order:index.html.twig', array(
            'entities' => $entities,
        ));
    }

    /**
     * Displays a form to edit an existing Orders entity.
     *
     * @Route("/{id}/show", name="admin_order_show")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('VozminoskiStoreBundle:Orders')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Orders entity.');
        }

        return $this->render('VozminoskiStoreBundle:Admin/Order:show.html.twig', array(
            'entity'      => $entity
        ));
    }
}
